import { Controller } from 'egg';

const dataMap = new Map()

export default class SavePdfController extends Controller {
  public async index() {
    const { ctx } = this;
   
    const { data } = ctx.request.body || {}
    const id = Date.now()
    dataMap.clear()
    dataMap.set(id, data)
    
    ctx.response.body = {
      id: id
    }
  }

  // 获取详情
  public getSheetDetail() {
    const { ctx } = this;
    const { id } = ctx.request.body || {}
    console.log('id', id);
    
    const [, value] = dataMap.entries().next().value
    console.log('获取结果', value, dataMap.size);
    
    ctx.response.body = {
      data: value
    }
  }
}
